<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>websocket</title>
</head>

<body>
  <script>
    // 文献 http://www.ruanyifeng.com/blog/2017/05/websocket.html
    /**
     * var ws = new WebSocket("wss://echo.websocket.org");
        ws.onopen = function(evt) { //开启的回调
          console.log("Connection open ..."); 
          ws.send("Hello WebSockets!");
        };
        ws.onmessage = function(evt) { // 后端发来消息的回调
          console.log( "Received Message: " + evt.data);
          ws.close();
        };
        ws.onclose = function(evt) { // 关闭的回调
          console.log("Connection closed.");
        };  
    */
  </script>
</body>

</html>